<?php
/*
 * content : 返回单例工厂类
 * Author  : Songyicong 
 * time    : 2018-04-16 17:00:46 
 * email   : m13726262373@163.com 
 */
namespace app\api\extra;

class Factory{
    private static $Factory;
    private function __construct(){}
    public static function getInstance($className,$options = null){
        if(!isset(self::$Factory[$className]) || !self::$Factory[$className]){
            //如果不存在类，那么实例化
            self::$Factory[$className] = new $className($options);
        }
        return self::$Factory[$className];
    }
}